#include "GameClass.h"


CGameClass::CGameClass(CD3D9Engine* ptrEngine)
{
	if(ptrEngine != NULL)
	{
		_ptrEngine = ptrEngine;
		_ptrInput = _ptrEngine->GetInput();
		_isRunning = true;
	}
	else
	{
		_isRunning = false;
		_ptrEngine = NULL;
		_ptrInput = NULL;
	}

	_timer = new CTimer();

	_lastFrameTime = 0.0f;
	_currentFrameTime = 0.0f;

	_sceneGraph = new CSceneGraph(_ptrEngine);

	//_sceneGraph = new CSceneGraph(_ptrEngine);
	//RECT r;
	//SetRect(&r, 0, 0, _ptrEngine->GetWindowWidth(), _ptrEngine->GetWindowHeight());
	//_sceneGraph->SetRenderArea(r);

	WindowWidth = _ptrEngine->GetWindowWidth();
	WindowHeight = _ptrEngine->GetWindowHeight();

}


CGameClass::~CGameClass()
{
	SAFE_DELETE(_timer);
	SAFE_DELETE(_sceneGraph);
}


CResourceSprite* CGameClass::NewGameSprite(char* filename, int width, int height, unsigned long colorMask)
{
	if(_ptrEngine != NULL)
	{
		return _ptrEngine->CreateSprite(filename, width, height, colorMask);
	}

	return NULL;
}